package problem.nc090;

import java.util.Stack;

public class Solution {
    /*
    *   因为题目中给定了调用相关函数的时候，确保栈中有元素。
    * */
    Stack<Integer> stack = new Stack<>();
    Stack<Integer> minStack = new Stack<>();

    public void push(int node) {
        stack.push(node);

        if(!minStack.empty()){
            minStack.push(Math.min(minStack.peek(),node));
        }else{
            minStack.push(node);
        }
    }

    public void pop() {
        stack.pop();
        minStack.pop();
    }

    public int top() {
        return stack.peek();

    }

    public int min() {
        return minStack.peek();

    }
}